//
//  MBUploadTextDetailCell.swift
//  MasterBoy
//
//  Created by kyson on 2023/10/23.
//

import Foundation
import YYText
import SnapKit



class MBUploadTextDetailCell: MBDCommonCell {

    var titleLabel : YYLabel!

    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.initialize()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        
        self.initialize()
    }
    
    override var cellModel: Any! {
        didSet {
            let realCellModel = cellModel as! MBDUploadGroupBaseCellModel
            titleLabel.textLayout = realCellModel.textlayout
            
            titleLabel.snp.updateConstraints { make in
                let height = realCellModel.textlayout!.textBoundingSize.height
                make.height.equalTo(height)
            }
        }
    }
    
    func initialize() {
        self.contentView.setDynamicForgroundColor()
        self.commonBackgroundView.setDynamicForgroundColor()

        titleLabel = YYLabel()
        self.contentView.addSubview(titleLabel)

        titleLabel.snp.makeConstraints { make in
            make.centerY.equalTo(self.contentView)
            make.left.equalTo(20)
            make.right.equalTo(rightArrowImage.snp.left).offset(-10)
            make.height.equalTo(18)
        }
        
    }
    
}

